home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / system / skey40.zip / LANGDEMO.BAT < prev    next >
DOS Batch File  |  1991-12-23  |  2KB  |  63 lines

  1. :Batutil c(o) 1991 Barry Simon and Richard Wilson
  2. : Version 4.0
  3. echo off
  4. cls
  5. batutil {inc %0 code}
  6. goto end
  7. :code
  8. RC $
  9. {AT 02}{CU -}{CL}{RO 5}{CO 5}
  10. echoln  This demo shows the language capabilities of BATUTIL, new in version 4.
  11. echoln $S       First we'll show a multiplication table made with a
  12. echoln $S       nested BATUTIL for loop, string manipulation and arithmetic
  13. echoln
  14. GE WA3 EL
  15. AT 0E
  16. for $1=1 to 10 begin
  17.   CO 15
  18.   for $2=1 to 10 echo $s(F,$V($1*$2),R,4)
  19.   echoln
  20. end
  21. GE WA5 EL
  22. AT 1E
  23. CL
  24. $2=3
  25. echo $_$_Enter a number between 40 and 200$_$S$S$S
  26. goto firsttry
  27. ;code to handle incorrect entry starts here; given 3 choices
  28. la tryagain
  29. CL
  30. if $2=0 then begin
  31.   echo $_$_OK; we'll take the number to be 100 then!$_$_
  32.   $1=100
  33.   go gotpast
  34. end
  35. echo $_$_Sorry; I want a number between 40 and 200$_$S$S$S
  36. so 2
  37. la firsttry
  38. $1=$N
  39. --$2
  40. isnum $1 40 200
  41. if $r>0 then go tryagain
  42. la gotpast
  43. $2=$V($J+$1)
  44. echoln The date $1 days from now will be $E($2).
  45. GE WA4 EL
  46. echo $_$_   Notice that BATUTIL can accept numeric input, test its range
  47. echo $_     and do date arithmetic.$_
  48. echo $_   BATUTIL's for command allows both incremental numbers and
  49. echo $_     lists/filenames as with DOS batch command.  Fordir will read
  50. echo $_     all directories on a disk and let you manipulate them.
  51. echo $_     Here, we'll just list their names...this may take a moment.
  52. GE WA2 EL
  53. fordir $2 in (\) do echoln $2
  54. GE WA3 EL
  55. {AT 0F} CL {RO 5}
  56. echoln Please enter a sentence.  Do NOT use the character $$.
  57. $2=$Q
  58. $1=$s(W,$2,0)
  59. if $1 > 2 then $3=$s(W,$2,3) else $3=you$Shad$Sfewer$Sthan$Sthree$Swords
  60. echo $_$_ Your sentence had $1 words. The third word was "$3".$_
  61. GE WA5 EL
  62. :end
  63.